package com.kinyx.framework.db.sentence.res;

import org.junit.Test;

public class Order_Tester_ extends SUPER {

	public void test(final String tableAlias, final int tableIdx, final Column column, final String columnName, final String fieldName, final boolean asc) {
		final Order order = new Order(column.idx(tableIdx), asc);

		final String sentence1 = columnName + " " + (asc ? "ASC" : "DESC");
		final String sentence2 = fieldName + " " + (asc ? "ASC" : "DESC");
		final String sentence3 = tableAlias + (tableIdx == 0 ? "" : tableIdx) + "." + sentence1;
		final String sentence4 = tableAlias + (tableIdx == 0 ? "" : tableIdx) + "." + sentence2;

		this.test_getSentence(order, //
				sentence1, //
				sentence2, //
				sentence3, //
				sentence4 //
		);
		this.test_toString(order, //
				"SQL: [" + sentence1 + "]", //
				"HQL: [" + sentence2 + "]", //
				"SQL: [" + sentence3 + "]", //
				"HQL: [" + sentence4 + "]" //
		);
	}

	@Test
	public void test() {
		this.list_flag.forEach(flag -> {
			this.list_tableIdx.forEach(tableIdx -> {
				this.list_column.forEach(column -> {
					this.test("demoEntity", tableIdx, column.column, column.columnName, column.fieldName, flag);
				});
			});
		});
	}

}
